package cn.bearspark.comment.provider.dao.key;

import cn.bearspark.framework.redis.starter.buffer.hash.un.RedisHashBufferKeyBuilder;
import cn.bearspark.framework.redis.starter.key.RedisKeyBuilder;
import org.springframework.stereotype.Component;

/**
 * 楼评论的缓存器的键的构造器
 *
 * @author f
 */
@Component
public class BldgCommentBufferKeyBuilder extends RedisKeyBuilder implements RedisHashBufferKeyBuilder {

    /**
     * 楼评论数据 的缓存的键的前缀
     */
    private static final String BLDG_COMMENT_INFO = "bldgCommentInfo";

    /**
     * 楼评论 id 的缓存的键的前缀
     */
    private static final String BLDG_COMMENT_ID_INFO = "bldgCommentIdInfo";

    @Override
    public String buildHashBufferKey(long id) {
        return super.getPrefix() + BLDG_COMMENT_INFO + super.getSplitItem() + id;
    }

    public String buildBldgIdInfoKey(long bldgCommentId, int order) {
        return super.getPrefix() + BLDG_COMMENT_ID_INFO +
               super.getSplitItem() + bldgCommentId +
               super.getSplitItem() + order;
    }
}
